package com.mx.adapt

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.viewbinding.ViewBinding

class MXSimpleAdapt<T>(
    private val layoutRes: Int,
    private val bindingCall: ((position: Int, binding: ViewBinding, record: T) -> Unit)
) : MXBaseSimpleAdapt<T>() {
    override fun createItem(inflater: LayoutInflater, parent: ViewGroup, viewType: Int): ViewBinding {
        return ViewBinding{ inflater.inflate(layoutRes, parent, false) }
    }

    override fun bindView(position: Int, binding: ViewBinding, record: T) {
        bindingCall.invoke(position, binding, record)
    }
}